package com.linkai.源码;


/**
 * @Description:
 * @Author: 林凯
 * @Date: 2021/10/29 18:42
 */
public class Test {
    public static boolean test(String str) {
        // 192.0.0.1
        String[] split = str.split(".");

        if(split.length != 4) {
            return false;
        }

        for(int i = 0; i < 4; i++) {
            int tempNumber = -1;
            try {
                tempNumber = Integer.valueOf(split[i]);
                System.out.println(tempNumber);
            } catch(Exception e) {
                e.printStackTrace();
            } finally {

            }
            if(tempNumber < 0 || tempNumber > 255) {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        //Scanner in = new Scanner(System.in);
        //String str = in.nextLine()();
        //System.out.println(a);
//        String str = "127.0.0.1";
//        System.out.println(test(str));
//        System.out.println("Hello World!");
        String str = "127.0.0.1";
        String str3 = "abc-efg-aa-ff";
        String[] a = str.split("\\.");
        for (int i = 0; i < 4; i++) {
            System.out.println(a[i]);
        }
    }
}
